@extends('layouts.prize')
@section('pageTitle', '编辑奖品')
@inject('storeService', 'App\App\Services\StorageService')
@section('style')
    <link rel="stylesheet" href="/css/admin/validform_style.css">
    <style>

        /*meiyun*/
        .mgud {
            margin: 20px auto;
        }

        .mgb10 {
            margin-bottom: 10px;
        }

        .mgr30 {
            margin-right: 30px;
        }

        .main-panel {
            overflow: auto;
        }

        .card form [class*="col-"]:first-child {
            padding: 0 6px;
        }

        .card form [class*="col-"]:last-child {
            padding: 0 6px;
        }

        .template-active-img img {
            width: 100%;
            height: auto;
            overflow: hidden;
        }

        .template-active-img .user-template-btn {
            position: absolute;
            bottom: 20px;
            left: 50%;
            margin-left: -22px;
        }

        .template-active-img .template-qrcode {
            width: 100%;
            height: 100%;
            position: absolute;
            left: 0;
            top: 0;
            background: rgba(0, 0, 0, .5);
            display: none;
        }

        .template-active-img:hover .template-qrcode {
            display: block
        }

        .offline-input .card {
            margin-top: 15px;
            margin-bottom: 0;
        }

        .offline-input .card .form-group:last-child {
            margin-bottom: 0;
        }

        .offline-input .card .delete-icon {
            margin: 5px;
            cursor: pointer;
        }
    </style>
@endsection
@section('content')
    {{--@component('components.web.sidemenu')@endcomponent--}}
    <div class="main-panel">
        <div class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="content content-full-width">
                                <ul role="tablist" class="nav nav-tabs">
                                    <li class="gift-tab active" role="entity">
                                        <a href="#gift" data-toggle="tab"><i class="glyphicon glyphicon-gift"></i>
                                            优惠券</a>
                                    </li>
                                </ul>
                                <div class="tab-content">
                                    <div id="coupon" class="tab-pane coupon-tab-pane mrgud_10 active">
                                        <div class="row">
                                            <div class="col-md-12">
                                                <form id="wizardForm" class="form-horizontal" method="post" action=""
                                                      enctype="multipart/form-data">
                                                    {{ csrf_field() }}
                                                    <input type="hidden" value="{{$prizeInfo['id']}}"
                                                           name="data[prize][id]">
                                                    <input type="hidden" value="coupon" name="data[prize][type_code]">
                                                    <input type="hidden" value="1" name="data[prize][resource]">
                                                    <div class="row">
                                                        <div class="col-xs-4 app">
                                                            <div class="phone-view">
                                                                <div class="app-view">
                                                                    <div class="app-mainC">
                                                                        <div class="app-alert">
                                                                            <div class="app-alert-input">
                                                                                <div class="app-alert-image">
                                                                                    <img src="/images/admin/promotion_default.png">
                                                                                </div>
                                                                                <div class="app-alert-title">
                                                                                    <div class="title-name">{{$prizeInfo['name']}}</div>
                                                                                    <div class="title-endtime">有效期:<span
                                                                                                class="title-endtime-span">{{$prizeInfo['expired_end']}}</span>
                                                                                    </div>
                                                                                </div>

                                                                            </div>
                                                                            <div class="app-alert-word displayable">
                                                                                <div class="app-alert-code">{{$prizeInfo['voucher_code']}}</div>
                                                                                <div class="app-alert-text">
                                                                                    长按复制卷码去兑奖
                                                                                </div>
                                                                            </div>

                                                                        </div>
                                                                        <div class="app-btn"></div>
                                                                        <div class="app-paper"></div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-xs-8">
                                                            <div class="row">
                                                                <div class="col-sm-12">
                                                                    <div class="form-group">
                                                                        <label class="col-sm-2 col-sm-offset-1 control-label">奖品名称</label>
                                                                        <div class="col-sm-7 col-sm-offset-1">
                                                                            <input class="form-control prize-code-name"
                                                                                   type="text"
                                                                                   name="data[prize][name]"
                                                                                   datatype="s1-20"
                                                                                   ajaxurl="/web/prize/checkName/{{$prizeInfo['id']}}"
                                                                                   value="{{$prizeInfo['name']}}">
                                                                            <div class="info"><span
                                                                                        class="Validform_checktip"></span><span
                                                                                        class="dec"><s class="dec1">&#9670;</s><s
                                                                                            class="dec2">&#9670;</s></span>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <div class="form-group">
                                                                        <label class="col-sm-2 col-sm-offset-1 control-label">有效时间</label>
                                                                        <div class="col-sm-7 col-sm-offset-1">
                                                                            <div class="row service-charges">
                                                                                <div class="col-md-5 service-charges-name service-charges-name-0"
                                                                                     style="padding-left: 15px;">
                                                                                    <input type="text"
                                                                                           placeholder="开始时间"
                                                                                           required=""
                                                                                           name="data[prize][expired_start]"
                                                                                           data-msg="请输入开始时间"
                                                                                           class="form-control datetimepicker codestartdate"
                                                                                           datatype="*"
                                                                                           nullmsg="选择开始时间"
                                                                                           value="{{$prizeInfo['expired_start']}}">
                                                                                    <div class="info"><span
                                                                                                class="Validform_checktip"></span><span
                                                                                                class="dec"><s
                                                                                                    class="dec1">&#9670;</s><s
                                                                                                    class="dec2">&#9670;</s></span>
                                                                                    </div>
                                                                                </div>
                                                                                <div class="col-md-5 service-charges-remark service-charges-remark-0">
                                                                                    <input type="text"
                                                                                           placeholder="结束时间"
                                                                                           required=""
                                                                                           name="data[prize][expired_end]"
                                                                                           data-msg="请输入结束时间"
                                                                                           class="form-control datetimepicker codeenddate"
                                                                                           datatype="*"
                                                                                           nullmsg="选择结束时间"
                                                                                           value="{{$prizeInfo['expired_end']}}">
                                                                                    <div class="info"><span
                                                                                                class="Validform_checktip"></span><span
                                                                                                class="dec"><s
                                                                                                    class="dec1">&#9670;</s><s
                                                                                                    class="dec2">&#9670;</s></span>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    {{--<div class="form-group">--}}
                                                                        {{--<label class="col-sm-2 col-sm-offset-1 control-label">奖品库存</label>--}}
                                                                        {{--<div class="col-sm-7 col-sm-offset-1">--}}
                                                                            {{--<input class="form-control" type="number"--}}
                                                                                   {{--placeholder="最大为9999999"--}}
                                                                                   {{--required="required"--}}
                                                                                   {{--name="data[prize][stock_number]"--}}
                                                                                   {{--number="true"--}}
                                                                                   {{--max="9999999" datatype="n1-7"--}}
                                                                                   {{--nullmsg="输入库存数量"--}}
                                                                                   {{--value="{{$prizeInfo['stock_number']}}">--}}
                                                                            {{--<div class="info"><span--}}
                                                                                        {{--class="Validform_checktip"></span><span--}}
                                                                                        {{--class="dec"><s class="dec1">&#9670;</s><s--}}
                                                                                            {{--class="dec2">&#9670;</s></span>--}}
                                                                            {{--</div>--}}
                                                                        {{--</div>--}}
                                                                    {{--</div>--}}
                                                                    {{--<div class="form-group">--}}
                                                                        {{--<label class="col-sm-2 col-sm-offset-1 control-label">卷码类型</label>--}}
                                                                        {{--<div class="col-sm-7 col-sm-offset-1">--}}
                                                                            {{--<label class="radio-inline displayable">--}}
                                                                                {{--<input type="radio"--}}
                                                                                       {{--name="data[prize][voucher_type]"--}}
                                                                                       {{--class="nocode"--}}
                                                                                       {{--value="0">--}}
                                                                                {{--无券码--}}
                                                                            {{--</label>--}}
                                                                            {{--<label class="radio-inline">--}}
                                                                                {{--<input type="radio"--}}
                                                                                       {{--name="data[prize][voucher_type]"--}}
                                                                                       {{--class="samecode"--}}
                                                                                       {{--value="1"> 统一码--}}
                                                                            {{--</label>--}}
                                                                            {{--<label class="radio-inline">--}}
                                                                                {{--<input type="radio"--}}
                                                                                       {{--name="data[prize][voucher_type]"--}}
                                                                                       {{--class="slfcode"--}}
                                                                                       {{--value="2" disabled="disabled">--}}
                                                                                {{--自定义导入--}}
                                                                            {{--</label>--}}
                                                                            {{--<span class="help-block">注意：奖品保存后券码类型不能修改。</span>--}}
                                                                        {{--</div>--}}
                                                                    {{--</div>--}}
                                                                    {{--<div class="samecouponCode-input displayable">--}}
                                                                        {{--<div class="form-group">--}}
                                                                            {{--<label class="col-sm-2 col-sm-offset-1 control-label">统一卷码</label>--}}
                                                                            {{--<div class="col-sm-7 col-sm-offset-1">--}}
                                                                                {{--<input class="form-control" type="text"--}}
                                                                                       {{--placeholder="请输入卷码"--}}
                                                                                       {{--name="data[prize][voucher_code]"--}}
                                                                                       {{--ignore="ignore"--}}
                                                                                       {{--value="{{$prizeInfo['voucher_code']}}">--}}
                                                                                {{--<div class="info"><span--}}
                                                                                            {{--class="Validform_checktip"></span><span--}}
                                                                                            {{--class="dec"><s class="dec1">&#9670;</s><s--}}
                                                                                                {{--class="dec2">&#9670;</s></span>--}}
                                                                                {{--</div>--}}
                                                                            {{--</div>--}}
                                                                        {{--</div>--}}
                                                                    {{--</div>--}}
                                                                    <div class="slfcouponCode-input displayable">
                                                                        <div class="form-group">
                                                                            <label class="col-sm-2 col-sm-offset-1 control-label">上传卷码</label>
                                                                            <div class="col-sm-7 col-sm-offset-1">
                                                                                <input class="form-control csv fileInput"
                                                                                       type="file" name="upfile"
                                                                                       ignore="ignore"
                                                                                       data-for="data[prize][voucher_link]"
                                                                                       data-preview-file-type="text"
                                                                                       value="{{$storeService->tomedia($prizeInfo['voucher_link'])}}">
                                                                                <input type="hidden"
                                                                                       name="data[prize][voucher_link]"
                                                                                       value="{{$prizeInfo['voucher_link']}}">
                                                                                <div class="info"><span
                                                                                            class="Validform_checktip"></span><span
                                                                                            class="dec"><s class="dec1">&#9670;</s><s
                                                                                                class="dec2">&#9670;</s></span>
                                                                                </div>
                                                                                <span class="help-block">"提示：CSV格式，每次最多导入10000条记录。下载["
                                                <a href="/admin/卷码示例.csv" target="_blank">示例</a>
                                                "]"</span>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <div class="form-group">
                                                                        <label class="col-sm-2 col-sm-offset-1 control-label">兑奖方式</label>
                                                                        <div class="col-sm-7 col-sm-offset-1">
                                                                            <label class="radio-inline">
                                                                                <input type="radio"
                                                                                       name="data[prize][exchange_method]"
                                                                                       class="onlineprize" value="0"
                                                                                       @if($prizeInfo['exchange_method']==0) checked @endif>线上网址兑换
                                                                            </label>
                                                                            <label class="radio-inline">
                                                                                <input type="radio"
                                                                                       name="data[prize][exchange_method]"
                                                                                       class="offlineprize" value="1"
                                                                                       @if($prizeInfo['exchange_method']==1) checked @endif>线下门店兑换
                                                                            </label>
                                                                        </div>
                                                                    </div>

                                                                    <div class="form-group online-input" @if($prizeInfo['exchange_method'] == 1) style="display:none;" @endif>
                                                                        <label class="col-sm-2 col-sm-offset-1 control-label">兑奖链接</label>
                                                                        <div class="col-sm-7 col-sm-offset-1">
                                                                            <input class="form-control exchange_url"
                                                                                   type="text"
                                                                                   placeholder="例如：http://www.chinamcloud.com"
                                                                                   name="data[prize][exchange_url]"
                                                                                   value="{{$prizeInfo['exchange_url']}}">
                                                                            <div class="info"><span
                                                                                        class="Validform_checktip"></span><span
                                                                                        class="dec"><s class="dec1">&#9670;</s><s
                                                                                            class="dec2">&#9670;</s></span>
                                                                            </div>
                                                                        </div>
                                                                    </div>

                                                                    <div class="form-group offline-input"
                                                                         @if($prizeInfo['exchange_method'] == 0) style="display:none;" @endif>
                                                                        <label class="col-sm-2 col-sm-offset-1 control-label">自定义字段</label>
                                                                        <div class="col-md-7 col-sm-offset-1">
                                                                            <button type="button" class="btn btn-info add-group">&nbsp;&nbsp;+新建&nbsp;&nbsp;</button>
                                                                            <div class="card coupon-card">
                                                                                <div class="content">
                                                                                    @if(!isset($prizeInfo['extends']))
                                                                                    <div class="form-group">
                                                                                        <label class="col-md-1 col-sm-1 control-label">01</label>
                                                                                        <div class="col-md-7 col-sm-7">
                                                                                            <input class="form-control"
                                                                                                   type="text"
                                                                                                   name="fields[0]"
                                                                                                   placeholder="请输入字段名称"
                                                                                                   data-msg="请输入字段名称"/>
                                                                                        </div>
                                                                                        <div class="delete-icon">
                                                                                            <img src="/images/admin/delet_red.png"
                                                                                                 class="delete-icon">
                                                                                        </div>
                                                                                    </div>
                                                                                    @else
                                                                                        @foreach($prizeInfo['extends'] as $i => $item)
                                                                                            <div class="form-group">
                                                                                                <label class="col-md-1 col-sm-1 control-label">
                                                                                                    @if($i<10)
                                                                                                        0{{$i+1}}
                                                                                                    @else
                                                                                                        {{$i+1}}
                                                                                                    @endif</label>
                                                                                                <div class="col-md-7 col-sm-7">
                                                                                                    <input class="form-control"
                                                                                                           type="text"
                                                                                                           name="fields[{{ $i }}]"
                                                                                                           placeholder="请输入字段名称"
                                                                                                           data-msg="请输入字段名称"
                                                                                                           value="{{ $item }}"/>
                                                                                                </div>
                                                                                                <div class="delete-icon">
                                                                                                    <img src="/images/admin/delet_red.png"
                                                                                                         class="delete-icon">
                                                                                                </div>
                                                                                            </div>
                                                                                        @endforeach
                                                                                    @endif
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    {{--<div class="form-group">--}}
                                                                        {{--<label class="col-sm-2 col-sm-offset-1 control-label">奖品标签</label>--}}
                                                                        {{--<div class="col-sm-7 col-sm-offset-1">--}}
                                            {{--<textarea class="form-control" type="text" name="data[prize][tag]"--}}
                                                      {{--ignore="ignore">{{$prizeInfo['tag']}}</textarea>--}}
                                                                            {{--<div class="info"><span--}}
                                                                                        {{--class="Validform_checktip"></span><span--}}
                                                                                        {{--class="dec"><s class="dec1">&#9670;</s><s--}}
                                                                                            {{--class="dec2">&#9670;</s></span>--}}
                                                                            {{--</div>--}}
                                                                        {{--</div>--}}
                                                                    {{--</div>--}}
                                                                    <div class="form-group backgroundImg-container">
                                                                        <label class="col-sm-2 col-sm-offset-1 control-label">奖品图片</label>
                                                                        <div class="col-sm-7 col-sm-offset-1">
                                                                            <input type="file" name="upfile"
                                                                                   accept="image/gif,image/jpeg,image/png"
                                                                                   data-target="uploadBackgroundFile"
                                                                                   data-preview-file-type="text"
                                                                                   class="form-control fileInput"
                                                                                   value="{{$storeService->tomedia($prizeInfo['background_image'])}}"
                                                                                   title=""
                                                                                   data-for="data[prize][background_image]">
                                                                            <input type="hidden"
                                                                                   name="data[prize][background_image]"
                                                                                   value="{{$prizeInfo['background_image']}}">
                                                                            <div class="info"><span
                                                                                        class="Validform_checktip"></span><span
                                                                                        class="dec"><s class="dec1">&#9670;</s><s
                                                                                            class="dec2">&#9670;</s></span>
                                                                            </div>
                                                                            <span class="help-block">100*100像素，支持PNG、JPG格式，小于200KB</span>
                                                                        </div>
                                                                    </div>
                                                                    <div class="row">
                                                                        <div class="col-sm-9 col-sm-offset-2">
                                                                            <div class="panel panel-info">
                                                                                <div class="panel-heading">
                                                                                    <h3 class="panel-title">奖品赞助商信息</h3>
                                                                                </div>
                                                                                <div class="panel-body sponsor_panel">
                                                                                    @foreach($prizeInfo['sponsor'] as $sponsor)
                                                                                        <div class="sponsor_form">
                                                                                            <div class="row">
                                                                                                <div class="col-sm-12">
                                                                                                    <img src="/images/admin/delet_red.png"
                                                                                                         class="sponsor_delet pull-right mgb10 mgr30">
                                                                                                </div>
                                                                                                <div class="form-group">
                                                                                                    <label class="col-sm-3 control-label">赞助商信息</label>
                                                                                                    <div class="col-sm-8 ">
                                                                                                        <input class="form-control"
                                                                                                               type="text"
                                                                                                               name="data[sponsor][name][]"
                                                                                                               datatype="sponsor"
                                                                                                               value="{{$sponsor['name']}}">
                                                                                                        <div class="info"><span
                                                                                                                    class="Validform_checktip"></span><span
                                                                                                                    class="dec"><s
                                                                                                                        class="dec1">&#9670;</s><s
                                                                                                                        class="dec2">&#9670;</s></span>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                </div>
                                                                                                <div class="form-group">
                                                                                                    <label class="col-sm-3 control-label">商家Logo</label>
                                                                                                    <div class="col-sm-8">
                                                                                                        <input type="file"
                                                                                                               name="upfile"
                                                                                                               accept="image/gif,image/jpeg,image/png"
                                                                                                               data-target="uploadLogoFile"
                                                                                                               data-preview-file-type="text"
                                                                                                               class="form-control fileInput"
                                                                                                               value="{{$storeService->tomedia($sponsor['logo'])}}"
                                                                                                               title=""
                                                                                                               data-for="data[sponsor][logo][]">
                                                                                                        <input type="hidden"
                                                                                                               name="data[sponsor][logo][]"
                                                                                                               value="{{$sponsor['logo']}}">
                                                                                                        <div class="info"><span
                                                                                                                    class="Validform_checktip"></span><span
                                                                                                                    class="dec"><s
                                                                                                                        class="dec1">&#9670;</s><s
                                                                                                                        class="dec2">&#9670;</s></span>
                                                                                                        </div>
                                                                                                        <span class="help-block">支持PNG、JPG格式，小于200KB</span>
                                                                                                    </div>
                                                                                                </div>
                                                                                                <div class="form-group">
                                                                                                    <label class="col-sm-3 control-label">曝光率</label>
                                                                                                    <div class="col-sm-7">
                                                                                                        <input class="form-control ptr"
                                                                                                               type="number"
                                                                                                               name="data[sponsor][percent][]"
                                                                                                               datatype="/^100$|^[0-9]{1,2}$/"
                                                                                                               errormsg="只能输入0~100的整数"
                                                                                                               value="{{$sponsor['percent']}}">
                                                                                                        <div class="info"><span
                                                                                                                    class="Validform_checktip"></span><span
                                                                                                                    class="dec"><s
                                                                                                                        class="dec1">&#9670;</s><s
                                                                                                                        class="dec2">&#9670;</s></span>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <label class="col-sm-1 control-label ptl">%</label>
                                                                                                </div>
                                                                                            </div>
                                                                                        </div>
                                                                                    @endforeach
                                                                                    <div class="pull-center mgud">
                                                                                        <button type="button"
                                                                                                class="btn btn-info btn-wd btn-finish panel-sponsor-butten">
                                                                                            添加一个新的赞助商
                                                                                        </button>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                        </div>
                                                    </div>
                                                    <div class="footer pull-center">
                                                        <button type="submit"
                                                                class="btn btn-submit btn-info btn-fill btn-wd btn-finish sponsor_sur">
                                                            完成
                                                        </button>
                                                        <div class="clearfix"></div>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
@endsection
@section('script')
    <script src="/js/admin/Validform_v5.3.2_min.js"></script>
    <script src="/js/initValidform.js"></script>
    <script>
        $.fn.serializeObject = function()
        {
            var o = {};
            var a = this.serializeArray();
            $.each(a, function() {
                if (o[this.name] !== undefined) {
                    if (!o[this.name].push) {
                        o[this.name] = [o[this.name]];
                    }
                    o[this.name].push(this.value || '');
                } else {
                    o[this.name] = this.value || '';
                }
            });
            return o;
        };
		$(document).ready(function () {
            //==================================================
            $('.onlineprize').click(function(){
                $('.online-input').show();
                $('.offline-input').hide();
            });
            $('.offlineprize').click(function(){
                $('.online-input').hide();
                $('.offline-input').show();
            });
            function sort(){
                $('.coupon-card.card .form-group').each(function(i,ele){
                    var index = (i+1)<10?'0'+(i+1):(i+1);
                    $(ele).find('.control-label').text(index);
                    $(ele).find('input').attr('name','fields['+i+']');
                });
            }
            $('.add-group').click(function(e) {
                var length = $('.coupon-card.card .form-group').length+1;
                var currentIndex = (length < 10 ? '0' + length : length);
                var html = '<div class="form-group">' +
                    '       <label class="col-md-1 col-sm-1 control-label">' + currentIndex + '</label>' +
                    '       <div class="col-md-7 col-sm-7">' +
                    '         <input class="form-control" type="text"' +
                    '                 name="fields['+ $('.coupon-card.card .form-group').length +']"' +
                    '                 placeholder="请输入字段名称"' +
                    '                 data-msg="请输入字段名称"/>' +
                    '       </div>' +
                    '       <div class="delete-icon">' +
                    '           <img src="/images/admin/delet_red.png" class="delete-icon">' +
                    '       </div>' +
                    '  </div>';
                $('.coupon-card.card .content').append(html);
            });
            //删除自定义字段
            $('.coupon-card').on('click','.delete-icon',function () {
                $(this).closest('.form-group').remove();
                sort();
            });
            //===================================================
			$('.nocode').click(function () {
				$('.samecouponCode-input').addClass('displayable');
				$('.slfcouponCode-input').addClass('displayable');
				$('.app-alert-word').addClass('displayable');
			});
			$('.samecode').click(function () {
				$('.app-alert-code').empty();
				$('.samecouponCode-input').removeClass('displayable');
				$('.slfcouponCode-input').addClass('displayable');
				$('.app-alert-word').removeClass('displayable');
			});
			$('.slfcode').click(function () {
				$('.app-alert-code').html('0123456789');
				$('.samecouponCode-input').addClass('displayable');
				$('.slfcouponCode-input').removeClass('displayable');
				$('.app-alert-word').removeClass('displayable');
			});

			$('.panel-sponsor-butten').on('click', function () {
				var addObj = $(this).parent('.mgud');
				$.get('/web/prize/sponsor', function (res) {
					addObj.before(res);
					var fileInputObj = addObj.prev('.sponsor_form').find('.fileInput');
					initFileInput(fileInputObj);
					var deleteBtn = addObj.prev('.sponsor_form').find('.sponsor_delet');
					deleteBtn.click(function () {
						$(this).parents('.sponsor_form').remove();
					})
				});
			});
			$('.sponsor_form').on('click', '.sponsor_delet', function () {
				$(this).parents('.sponsor_form').remove();
			});

			$('.prize-code-name').blur(function () {
				if ($('.prize-code-name').val() == '') {
					$('.title-name').empty();
					$('.title-name').html('活动名称');
				}
			});
			$('.prize-code-name').on('input', function () {
				$('.title-name').empty();
				var name = $('.prize-code-name').val();
				$('.title-name').html(name);
			});

			$('.codeenddate').on('input', function () {
				var enddate = $(this).val();
				$('.title-endtime-span').html(enddate);
			})

			$('input[value="{{$prizeInfo['voucher_type']}}"]').prop('checked', 'checked').click();

			$('.fileInput').each(function () {
				initFileInput($(this));
			});

			$(".datetimepicker").datetimepicker({format: 'YYYY-MM-DD hh:mm:ss'});

			initValidform($('#wizardForm'));
		});
    </script>
@endsection